import store from '@/store/index.js';
import restUtil from '@/utils/restUtil.js';
var SaveCommand = function() {

};

SaveCommand.prototype.execute = function() {
	var componentModel = store.state.mformDesigner.componentModel;
	var dataSourceList=store.state.mformDesigner.$refs.dataSourceConfig.datasourceList;
	componentModel["dataSourceList"]=dataSourceList;
	let componentModelJson = JSON.stringify(componentModel);
	var propertyMap = componentModel["propertyMap"];
	var request = {
		"pageCode": propertyMap["pageCode"],
		"pageTitle": propertyMap["title"],
		"componentModelJson": componentModelJson,
		"currentComponentId":store.state.mformDesigner.getCreateContext().currentComponentId
	};
	restUtil.postAction(store.state.mformDesigner,"devformdesigner/dataSave", request).then(
		function(response) {
			if (response.data.code == 1) {
				store.state.mformDesigner.$alert('保存成功', '提示');
			} else {
				store.state.mformDesigner.$alert(response.data.message, '提示');
			}
		});
};
export default SaveCommand
